﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="System.Collections.Generic" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    事件处理列表
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%
        IEnumerable<EventRecordDetail> eventRecords = (IEnumerable<EventRecordDetail>)ViewData["eventRecords"];
        User user = (User) ViewData["user"];
        string[] types = (string[])ViewData["types"];
        string[] priorities = (string[])ViewData["priorites"];
    %>
    
    <table id="spdata" cellpadding="4" cellspacing="0" class="com_from_table3" style="vertical-align:middle;width:1100px;">
        <tr>
            <th style="width:60px;">编号</th>
            <th style="width:300px;">事件名称</th>
            <th style="width:120px;">事件现场</th>
            <th style="width:80px;">事件类别</th>
            <th style="width:90px;">事件级别</th>
            <th style="width:100px;">上报时间</th>
            <th style="width:80px;">延续天数</th>
            <th style="width:80px;">上报人</th>
            <th style="width:80px;">处理进度</th>
            <th>操作</th>
        </tr>
        <%
            int i = 0;
          foreach (EventRecordDetail e in eventRecords)
          {
              i++;
        %>
        <tr>
            <td class="textCenter"><%=i %></td>
            <td style="padding-left:0.5em;"><%=Html.CutString(e.Name, 30, "...") %></td>
            <td style="padding-left:0.5em;"><%=e.StackName %></td>
            <td class="textCenter" style="width:60px;"><%=types[e.Type] %></td>
            <td class="textCenter" style="width:60px;"><%=priorities[e.Priority] %></td>
            <td class="textCenter" style="width:100px;"><%=e.OccurredDate.ToString("yyyy-MM-dd HH:mm") %></td>
            <td class="textCenter" style="width:60px;"><%=(e.EndDate.Value.Date - e.OccurredDate.Date).Days + 1%></td>
            <td style="padding-left:0.5em;"><%=e.UserName %></td>
            <td class="textCenter" style="width:60px;"><%=e.Progress %>%</td>
            <td class="textCenter" style="width:60px;">
            <%if (e.Status == 0 && (user.RoleId == (int)RoleEnum.Recorder || user.RoleId == (int) RoleEnum.Expert) && e.CreateDate.Date == DateTime.Now.Date)
              { %>
              <%=Html.ActionLink("修改", "Edit", new { eventId = e.Id })%>
              <%=Html.ActionLink("删除", "Delete", new { eventId = e.Id }, new { onclick = "return confirm('确定删除事件吗？');" })%>
            <%}
              if (e.Status == 0 && (user.RoleId == (int)RoleEnum.Recorder || user.RoleId == (int) RoleEnum.Expert))
              {
            %>
            <div><%=Html.ActionLink("进程跟踪", "Track", new { eventId = e.Id })%></div>
            <%
               }else
              {
            %>
            <div><%=Html.ActionLink("进程详情", "Track", new { eventId = e.Id })%></div>
            <%
               }
            %>
            <%if (e.Status == 1 && user.RoleId == (int)RoleEnum.Auditor)
              { %>
              <div><%=Html.ActionLink("继续跟踪", "ReTrack", new { eventId = e.Id }, new { style = "margin-left:0px", onclick = "return confirm('确定重新跟踪吗？');" })%></div>
              <div><%=Html.ActionLink("确认结束", "EndEvent", new { eventId = e.Id }, new { style = "margin-left:0px" })%></div>
            <%}
            %>
            </td>
        </tr>
        <%} %>  
    </table>
    <%
        using (Html.BeginForm("List", "Event", FormMethod.Get))
        {
    %>
    <%=Html.Hidden("PageNo", (int)ViewData["currentPage"])%>
    <%=Html.Hidden("status", (int)ViewData["status"])%>
    <%
        }
    %>
    <% Html.RenderPartial("Pagination", ViewData); %>
</asp:Content>
